/**
 * 
 */
package com.archives.blog.common.utils;

import javax.servlet.http.HttpServletRequest;

import com.archives.blog.common.constant.Constants;
import com.archives.blog.common.domain.entity.Admin;

/**
 * @author chh
 *
 */
public class SessionUtil {
	
	private SessionUtil(){}

	public static void putAdminToSession(HttpServletRequest request, Admin admin){
		request.getSession().setAttribute(Constants.ERP_SESSION_LOGIN_OBJECT, admin);
	}
	
	public static Admin getLoginAdmin(HttpServletRequest request){
		return (Admin) request.getSession().getAttribute(Constants.ERP_SESSION_LOGIN_OBJECT);
	}
	
	public static String getString(HttpServletRequest request, String sessionPropertyName){
		return (String) request.getSession().getAttribute(sessionPropertyName);
	}
	
	public static Integer getInteger(HttpServletRequest request, String sessionPropertyName){
		return (Integer) request.getSession().getAttribute(sessionPropertyName);
	}
	
	public static Long getLong(HttpServletRequest request, String sessionPropertyName){
		return (Long) request.getSession().getAttribute(sessionPropertyName);
	}
	
	public static Object get(HttpServletRequest request, String sessionPropertyName){
		return (String) request.getSession().getAttribute(sessionPropertyName);
	}
}
